package cn.gson.boot.model.service;

import cn.gson.boot.model.dao.FaHuoDao;
import cn.gson.boot.model.dao.FaHuoXiangQinDao;
import cn.gson.boot.model.dao.WenDaDao;
import cn.gson.boot.model.mapper.FaHuoMapper;
import cn.gson.boot.model.mapper.FaHuoXiangQinMapper;
import cn.gson.boot.model.mapper.WenDaMapper;
import cn.gson.boot.model.pojos.Fahuo;
import cn.gson.boot.model.pojos.Fahuoxiangqing;
import cn.gson.boot.model.pojos.Wenda;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class WenDaService {
    @Autowired
    WenDaMapper wenDaMapper;
    @Autowired
    WenDaDao wenDaDao;

    //查询所有问答（根据问题模糊查询）
    public List<Wenda> selecAllWenDa(String wenti){
        return wenDaMapper.selecAllWenDa(wenti);
    }

    //新增问答
    public void addWenDa(Wenda wenda) {
        wenda.setWdYs(1);
        wenDaDao.save(wenda);
    }

    //移除问答
    public void yichuWenDa(Integer wdId){
        wenDaDao.yichuWenDa(wdId);
    }
}